package com.shangke.springbootkkyp.serview.imp;

import com.shangke.springbootkkyp.dao.UserDao;
import com.shangke.springbootkkyp.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class UserServiewImp implements com.shangke.springbootkkyp.serview.UserSerview {

    @Autowired
    UserDao userDao;

//    public static final String XXLSSOSESSI    ONID = findById();

    /**
     * login 登录新增，返回新增自断id
     * @param phone
     * @param code
     * @return
     */
    @Override
    public Integer verify_code_login(String phone, String code,String xxlSsoSessionid){
        if(userDao.save(phone,code,xxlSsoSessionid) > 0?true:false)
            return userDao.findMaxId();
        log.error("错误异常，UserServiewImp类verify_code_login方法sql语句出现了问题");
        return 0;
    }

    /**
     * 使用id查询用户
     * @param id
     * @return
     */
    public  User findById(Long id) {
        return userDao.findById(id);
    }
}
